package gui.obu;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;

public class ObuSidePanelImpl extends AbstractObuPanelImpl implements ObuSidePanel {
	
	public ObuSidePanelImpl(Display display, Shell shell) {
		super(display, shell);
	}

	private Button startBtn;
	private Button stopBtn;

	public void open() {
		// Remove at compile time
		Shell shell = new Shell();
		// **********************
		
		shell.setSize(200, 150);
		shell.setText("Ignition");
		
		startBtn = new Button(shell, SWT.NONE);
		startBtn.setBounds(55, 10, 75, 25);
		startBtn.setText("Start");
		startBtn.addListener(SWT.Selection, new Listener() {
			@Override
			public void handleEvent(Event event) {
				monitoring.start();
			}
		});
		
		stopBtn = new Button(shell, SWT.NONE);
		stopBtn.setBounds(55, 61, 75, 25);
		stopBtn.setText("Stop");
		stopBtn.addListener(SWT.Selection, new Listener() {
			@Override
			public void handleEvent(Event event) {
				monitoring.done();
			}
		});

		shell.open();
		shell.layout();
	}

	public void setWindow(ObuDrivingDisplayPanel window) {
		monitoring.setWindow(window);
	}
}
